
function reset(){
	$("#frm_login")[0].reset();
}


function rgreset(){
	$("#frm_register")[0].reset();
}


function register(){
	
	
	
	var rguname = $("#rguname").val();
	if (rguname.length == 0) {
		layer.tips("用户名不能为空!", "#rguname", {
			tips: 2,
			time: 1000
		});
		return;
	}
	
	
	
	var rgupwd = $("#rgupwd").val();
		if(rgupwd.length== 0){
			layer.tips("新密码不能为空！","#rgupwd",{
				tips:2,
				time:1000
			});
			return;
		}
	
	
	
	
	var rupwd = $("#rupwd").val();
		if(rupwd.length== 0){
			layer.tips("确认密码不能为空！","#rupwd",{
				tips:2,
				time:1000
			});
			return;
		}
	
	
	
	var rgupwd = $("#rgupwd").val();
		if(rgupwd.length<6){
			layer.tips("密码长度应在6-12位！","#rgupwd",{
				tips:2,
				time:1000
			});
			return;
		}
	
	
	
	
	var rgupwd = $("#rgupwd").val();
		if(rgupwd.length>12){
			layer.tips("密码长度应在6-12位！","#rgupwd",{
				tips:2,
				time:1000
			});
			return;
		}
	
	
	
	
	/*var rgupwd=$("#rgupwd").val();
		var patrn = /^[\w_-]{6,12}$/; 
			if(!patrn.exec(rgupwd)){
				layer.tips("密码格式不合法！","#rgupwd",{
					tips:1,
					time:1000
				});
				return;
			}*/
	
	
	
	
	
	
	/*var rgupwd=$('#rgupwd').val();
		var rupwd=$('#rupwd').val();
			var patrn = /^[\w_-]{6,12}$/; 
			if(!patrn.exec(rgupwd)){
				layer.tips("密码格式不合法！","#rgupwd",{
					tips:1,
					time:1000
				});
				return;
			}
			if(rgupwd!=rupwd){
				layer.tips("两次输入的密码应相同！","#rgupwd","rupwd",{
					tips:1,
					time:1000
				});
				return;
			}*/
			
			
			
	
		var rupwd=$('#rupwd').val();
		var rgupwd=$('#rgupwd').val();
			var patrn = /^[\w_-]{6,12}$/; 
			if(!patrn.exec(rgupwd)){
				layer.tips("密码格式不合法！","#rgupwd",{
					tips:1,
					time:1000
				});
				return;
			}
			if(rupwd!=rgupwd){
				layer.tips("两次输入的密码应相同！","#rupwd","#rgupwd",{
					tips:1,
					time:1000
				});
				return;
			}
	
			
			
	var email=$("#rgemail").val();
	var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
	if(!reg.test(email)){
		layer.tips("邮箱格式不合法！","#rgemail",{
			tips:1,
			time:1000
		});
		return;
	}
			
			
			$.ajax({
	url:"dataJSON/login.json",
	type:"get",
	dataType:"json",
	success:function(result){
		if(result.code==1){
			location.href="manager.html";
		}else
		{
			
		
		layer.msg("登录失败！",{icon:2,time:2000});
		
	}},
	error:function(){
		layer.msg("请求服务器失败！",{
			icon:2,
			time:2000
		});
	}
	});
			
			
			
			
}
